<!DOCTYPE HTML>
<html>
  <head>
    <title>Videos</title>
        <link type = "image/x-icon" rel="SHORTCUT ICON" href="img/favicon.ico" />	
        <script type="text/javascript" src="jquery/jquery-1.7.1.min.js"></script>     
		<link rel="stylesheet" href="css/style.css" />
        <link rel="stylesheet" href="css/grid-12.css" />

        
  </head>
  <body>
    <div id="container" class="container_12">
    
    <?php
    include("inc/db.class.php");
		require("php/header.php");
		include("inc/functions.php");
		
		
		?>
      <div id="line" class="grid_12"></div>
			<div id="" class="grid_12">
				<h3>Event videos</h3>
				<?php
				
				$simple = curlUsingGet("http://gdata.youtube.com/feeds/api/users/".YOUTUBE_USERNAME."/uploads");
				/*$p = xml_parser_create();
				xml_parse_into_struct($p, $simple, $vals, $index);
				xml_parser_free($p);*/
				$movies = new SimpleXMLElement($simple);
				$videos = $movies->entry;
				
				$i = 1;
				$htmlBody = "";
				foreach($videos as $video){
					$vid_id = explode("/",$video->id);
					$htmlBody .=  "<div style='width:350px; float: left;'><h3 style='width: 340px'>".$video->title."</h3>"."<div style='width: 340px'>".substr($video->content, 0, 100)."</div><iframe width='300' height='200' src='//www.youtube.com/embed/".$vid_id[count($vid_id) - 1]."' frameborder='0' allowfullscreen></iframe></div>";
					if($i++ % 2 == 0){
						$htmlBody .=  "<div sryle='clear: both;'>";
					}
				}
				echo $htmlBody;
				
?>
			</div>
						
			<?php require("php/footer.php"); ?>
    </div>
  </body>
</html>
